﻿using System.Collections.Generic;

public class MatchRoomManager
{
    /// <summary>
    /// 最大房间号
    /// </summary>
    private static int maxId = 0;
    /// <summary>
    /// 房间列表
    /// </summary>
    public static Dictionary<int, MatchRoom> matchRooms = new Dictionary<int, MatchRoom>();
    /// <summary>
    /// 获取房间
    /// </summary>
    /// <param name="roomid"></param>
    /// <returns></returns>
    public static MatchRoom GetRoom(int roomid)
    {
        if (matchRooms.ContainsKey(roomid))
            return matchRooms[roomid];
        return null;
    }
    /// <summary>
    /// 添加房间
    /// </summary>
    /// <returns></returns>
    public static MatchRoom AddRoom()
    {
        maxId++;
        MatchRoom room = new MatchRoom();
        room.roomid = maxId;

        room.lockStepManager.room = room;
        matchRooms.Add(room.roomid, room);
        return room;
    }
}

